package cn.jsj.user.manager;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jsj.utils.TimeDispose;

/**
 * 添加一位实习律师信息
 * @author LI
 *
 */
 public class AddPracLawyerInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("添加实习律师");

		 //新建实习律师对象
		 cn.jsj.pojo.TblPracticeLawyer tpl=new cn.jsj.pojo.TblPracticeLawyer();

		 //赋值
		 tpl.setBirthTime(TimeDispose.transferDate(request.getParameter("apracbirthtime")));
		 tpl.setDeleteLabel(0);
		 tpl.setEducationalLevel(request.getParameter("apraceducationallevel").trim());
		 tpl.setEndTime(TimeDispose.transferDate(request.getParameter("aendtime")));
		 tpl.setGraduateSchool(request.getParameter("apracgraduateschool").trim());
		 tpl.setGuidTeacher(Integer.parseInt(request.getParameter("guidteacher")));
		 tpl.setIdentityNumber(request.getParameter("apracidentitynumber").trim());
		 tpl.setLawyerPwd("111111");
		 tpl.setParcLawEmail(request.getParameter("apraclawyeremail").trim());
		 tpl.setPoliticalStatus(request.getParameter("apracpoliticalstatus").trim());
		 tpl.setPracAgreement(Integer.parseInt(request.getParameter("pracagreement").trim()));
		 tpl.setPracLawName(request.getParameter("apraclawyername").trim());
		 tpl.setPracLawPhone(request.getParameter("apraclawyerphone").trim());
		 tpl.setPracLawSex(request.getParameter("sex").trim());
		 tpl.setPracticeNumber(request.getParameter("apranumber").trim());
		 tpl.setStartTime(TimeDispose.transferDate(request.getParameter("astarttime")));
		 System.out.println("aaaaaaaaaaaaaaaaaaaaaa");

		 //新增属性
		 tpl.setArchiveAddr(request.getParameter("mplFrontOccupation").trim());
		 tpl.setHouseholdeAddr(request.getParameter("mplHouseholdAddr").trim());
		 tpl.setFrontOccupation(request.getParameter("mplArchiveAddr").trim());
		 tpl.setEligibleNumber(request.getParameter("mplEligibleNumb").trim());
		 //保存实习律师对象
		 cn.jsj.dao.TblPracticeLawyerDAO tpld=new cn.jsj.dao.TblPracticeLawyerDAO();
		 int saveResult=tpld.saveLawyerInfo(tpl);
		 System.out.println("aaaaaaaaaaaaaaaaaaaaaa");
		 //输出流
		 java.io.PrintWriter out=response.getWriter();
		 if(saveResult==1){
			 out.println("{message:'添加成功！'}");
		 }else{
			 out.println("{message:'添加失败！'}");
		 }

		 out.flush();
		 out.close();
	}
}